package com.five.exceptions.headler;

import com.five.exceptions.BusinessException;
import com.five.vo.BaseResultVO;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: star
 * @Date: 2021-05-18 21:46
 */
@ControllerAdvice
public class EducationExceptionHandler {

    @ResponseBody
    @ExceptionHandler({BusinessException.class})
    public BaseResultVO handlerBusinessExceptions(BusinessException e){
        BaseResultVO baseResultVO = new BaseResultVO();
        System.out.println("--------------------执行全局异常--------------------");
        baseResultVO.setCode(BaseResultVO.Code.BUSINESS_EXCEPTIONS.getValue());
        baseResultVO.setMessage(e.getMessage());

        return baseResultVO;
    }



}
